-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flyteconsole url to FlyteWorkflow CRD #5449
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5449 +/- ##
==========================================
- Coverage 61.93% 60.97% -0.96%
==========================================
Files 611 793 +182
Lines 36463 51352 +14889
==========================================
+ Hits 22582 31313 +8731
- Misses 11907 17152 +5245
- Partials 1974 2887 +913
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
75a3394
to
18011ab
Compare
@@ -4,7 +4,7 @@ import ( | |||
"github.com/flyteorg/flyte/flytepropeller/pkg/apis/flyteworkflow/v1alpha1" | |||
) | |||
|
|||
// go:generate mockery -case=underscore | |||
//go:generate mockery-v2 --case=underscore --with-expecter --name ExecutionContext --output=mocks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that we were not generating the mocks before. flyteorg/flytepropeller#600 introduced the go:generate
directive but unfortunately there was a typo.
Also notice that I'm moving to upstream mockery (as described in #4937) because our mockery fork couldn't generate the code for GetConsoleURL
due to the fact that it was coming to ExecutionContext
via other interface.
9d93791
to
d4e4e9f
Compare
d4e4e9f
to
43b5e0d
Compare
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
…late Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
43b5e0d
to
6593fdf
Compare
Signed-off-by: Eduardo Apolinario <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of nits
@@ -103,6 +103,9 @@ type ApplicationConfig struct { | |||
Envs map[string]string `json:"envs,omitempty"` | |||
|
|||
FeatureGates FeatureGates `json:"featureGates" pflag:",Enable experimental features."` | |||
|
|||
// A URL pointing to the flyteconsole instance used to hit this flyteadmin instance. | |||
ConsoleURL string `json:"consoleUrl,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConsoleURL string `json:"consoleUrl,omitempty"` | |
ConsoleURL string `json:"consoleUrl,omitempty" pflag:",A URL pointing to the flyteconsole instance used to hit this flyteadmin instance."` |
if e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL != "" { | ||
flyteWf.ConsoleURL = e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL != "" { | |
flyteWf.ConsoleURL = e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL | |
} | |
if consoleURL := e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL; len(consoleURL) > 0 { | |
flyteWf.ConsoleURL = consoleURL | |
} |
@@ -69,6 +70,14 @@ func GetExecutionEnvVars(id pluginsCore.TaskExecutionID) []v1.EnvVar { | |||
// }, | |||
} | |||
|
|||
if consoleURL != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if consoleURL != "" { | |
if len(consoleURL) > 0 { |
@@ -69,6 +70,14 @@ func GetExecutionEnvVars(id pluginsCore.TaskExecutionID) []v1.EnvVar { | |||
// }, | |||
} | |||
|
|||
if consoleURL != "" { | |||
envVars = append(envVars, v1.EnvVar{ | |||
Name: "FLYTE_EXECUTION_URL", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to const?
@@ -316,6 +316,19 @@ func BuildRawPod(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (*v | |||
return podSpec, &objectMeta, primaryContainerName, nil | |||
} | |||
|
|||
func shouldIncludeConsoleURL(taskTemplate *core.TaskTemplate) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func shouldIncludeConsoleURL(taskTemplate *core.TaskTemplate) bool { | |
func hasExternalLinkType(taskTemplate *core.TaskTemplate) bool { |
Signed-off-by: Eduardo Apolinario <[email protected]>
* Add `ConsoleURL` to `FlyteWorkflow` CRD Signed-off-by: Eduardo Apolinario <[email protected]> * Add `ConsoleURL` to flyteadmin config and write it to CRD Signed-off-by: Eduardo Apolinario <[email protected]> * Add ConsoleURL to application_config_provider and DeepCopyInto Signed-off-by: Eduardo Apolinario <[email protected]> * wip Signed-off-by: Eduardo Apolinario <[email protected]> * more wip Signed-off-by: Eduardo Apolinario <[email protected]> * Fix flyteplugins unit tests Signed-off-by: Eduardo Apolinario <[email protected]> * Fix existing propeller unit tests Signed-off-by: Eduardo Apolinario <[email protected]> * Add a few unit tests Signed-off-by: Eduardo Apolinario <[email protected]> * Include FLYTE_EXECUTION_URL iff "link_type" is set in the task template Signed-off-by: Eduardo Apolinario <[email protected]> * Remove TODOs Signed-off-by: Eduardo Apolinario <[email protected]> * Only include consoleURL if task set the relevant bit in its task template Signed-off-by: Eduardo Apolinario <[email protected]> * Fix flyteplugins tests Signed-off-by: Eduardo Apolinario <[email protected]> * Remove attempt number from the url Signed-off-by: Eduardo Apolinario <[email protected]> * Include review feedback Signed-off-by: Eduardo Apolinario <[email protected]> --------- Signed-off-by: Eduardo Apolinario <[email protected]> Co-authored-by: Eduardo Apolinario <[email protected]>
* Add flyteconsole url to FlyteWorkflow CRD (#5449) * Add `ConsoleURL` to `FlyteWorkflow` CRD Signed-off-by: Eduardo Apolinario <[email protected]> * Add `ConsoleURL` to flyteadmin config and write it to CRD Signed-off-by: Eduardo Apolinario <[email protected]> * Add ConsoleURL to application_config_provider and DeepCopyInto Signed-off-by: Eduardo Apolinario <[email protected]> * wip Signed-off-by: Eduardo Apolinario <[email protected]> * more wip Signed-off-by: Eduardo Apolinario <[email protected]> * Fix flyteplugins unit tests Signed-off-by: Eduardo Apolinario <[email protected]> * Fix existing propeller unit tests Signed-off-by: Eduardo Apolinario <[email protected]> * Add a few unit tests Signed-off-by: Eduardo Apolinario <[email protected]> * Include FLYTE_EXECUTION_URL iff "link_type" is set in the task template Signed-off-by: Eduardo Apolinario <[email protected]> * Remove TODOs Signed-off-by: Eduardo Apolinario <[email protected]> * Only include consoleURL if task set the relevant bit in its task template Signed-off-by: Eduardo Apolinario <[email protected]> * Fix flyteplugins tests Signed-off-by: Eduardo Apolinario <[email protected]> * Remove attempt number from the url Signed-off-by: Eduardo Apolinario <[email protected]> * Include review feedback Signed-off-by: Eduardo Apolinario <[email protected]> --------- Signed-off-by: Eduardo Apolinario <[email protected]> Co-authored-by: Eduardo Apolinario <[email protected]> Signed-off-by: Eduardo Apolinario <[email protected]> * Add mockery/v2 to boilerplate Signed-off-by: Eduardo Apolinario <[email protected]> * Remove TODO Signed-off-by: Eduardo Apolinario <[email protected]> --------- Signed-off-by: Eduardo Apolinario <[email protected]> Co-authored-by: Eduardo Apolinario <[email protected]>
Tracking issue
Related to #4773
Why are the changes needed?
This is a stacked PR on top of #5432. It adds a new field to the FlyteWorkflow CRD to help in the construction of flyteconsole urls pointing to node executions.edit: This PR started its life as a stacked PR, but can be completely separate from #5432. Let's separate those out in order to de-risk this change.
We need to provide a way for tasks to point to a flyteconsole address that corresponds to the execution of those particular tasks. This is useful, for example, if we want to provide third-party services with links to task executions. The first user of this feature is going to be the wandb flytekit plugin.
What changes were proposed in this pull request?
In this PR we introduce a new field to the
FlyteWorkflow
CRD to represent aflyteconsole
url. Most of the changes in the PR are about plumbing the necessary interfaces and implementations to use this new field.The end result is that the pod will contain a new environment variable called
FLYTE_EXECUTION_URL
in case it requested it and the flyteconsole url is provided in the flyteadmin configuration. The way a task requests to have this new env var injected is to definelink_type
in its task template. This is the de factor protocol we've been using to enable dynamic log links, so this PR leans on it.How was this patch tested?
functional tests and local testing using the demo cluster.
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link